class Course:
  def __init__(self, name, credit):
    self.__name = name
    self.__credit = credit
    # Course.course[self.__name] = self.__credit

  def getName(self):
    return self.__name

  def getCredit(self):
    return self.__credit

class CourseManage:
  def __init__(self):
    self.__course_list = []

  def addCourse(self, course):
    '''
    添加课程
    :param name:
    :param credit:
    :return:
    '''
    self.__course_list.append(course)

  def deleteCourse(self, name):
    '''
    删除课程
    :param name:
    :return:
    '''
    for course in self.__course_list:
      if course.getName() == name:
        self.__course_list.remove(course)
        print("已删除")
        break
      else:
        print("没有该课程")
    print("删除之后的列表：")
    self.show()

  def show(self):
    '''
    查看课程
    '''
    for i in self.__course_list:
      print(i.getName(), i.getCredit())
    # print(CourseManage.course_list)

if __name__ == '__main__':
  cm = CourseManage()
  c1 = Course("ds", 8.0)
  cm.addCourse(c1)
  c2 = Course("os", 6.0)
  cm.addCourse(c2)
  c3 = Course("co", 8.0)
  cm.addCourse(c3)
  print("增加课程之后的课程列表")
  cm.show()

  print("删除ds")
  cm.deleteCourse("ds")








  # while True:
  #   print("|-------课程管理系统-------|")
  #   print("|--------1.增加课程--------|")
  #   print("|--------2.删除课程--------|")
  #   print("|--------3.查看课程--------|")
  #   choice = input()
  #   if choice == 1:
  #     c1 = Course("ds", 8.0)
  #     CourseManage.addCourse(c1)
  #     c2 = Course("os", 6.0)
  #     CourseManage.addCourse(c2)
  #     CourseManage.show()
  #   elif choice == 2:
  #     name = input("课程名：")
  #     (CourseManage.course_list).remove(Course.course[name])
  #   elif choice == 3:
  #     CourseManage.show()
  #   else:
  #     break


